#include "map.hpp"
#include "array.hpp"
#include <iostream>

using std::cout;
using std::endl;

void test_two_sum();
void test_search();


int main()
{
    test_two_sum();
    test_search();
    return 0;
}

void test_two_sum()
{
    int target_value = 7;
    vector<int> arr = {1, 2, 3, 4, 6};

    cout << "输入的数组是: " <<"{";
    for (int i = 0; i < arr.size(); i++) {
        cout << arr[i];
        if(i != arr.size() - 1) {
            cout << ", ";
        }
    }
    cout << "}" << endl;
    cout << "输入的目标之和是： " << target_value << endl;

    vector<int> res = two_sum(arr, target_value);

    cout << "答案为：{" << res[0] << " ," << res[1] << "}" << endl; 

}

void test_search()
{
    int target = 7;
    vector<int> nums = {1, 2, 3, 4, 6, 8, 9, 11};

    cout << "输入的数组是: " <<"{";
    for (int i = 0; i < nums.size(); i++) {
        cout << nums[i];
        if(i != nums.size() - 1) {
            cout << ", ";
        }
    }
    cout << "}" << endl;
    cout << "输入的目标是： " << target << endl;

    int res = search(nums, target);

    cout << "数组下标是：" << res << endl; 

}